/*
 * Copyright 2023-2085 xujin <ceo@itgrail.com>
 *
 * Licensed under the Grail License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://itgrail.com/docs?id=3&catalogId=87
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.itgrail.pilot.domain.user.enums;

import lombok.Getter;

public enum PeriodButtonTypeEnum {
    OBJECTIVE_SWITCH("objectiveSwitch", 1, "O的开关"),
    KEY_RESULT_SWITCH("keyResultSwitch", 2, "KR的开关"),
    WEIGHT_SWITCH("weightSwitch", 3, "权重的开关"),
    SCORE_SWITCH("scoreSwitch", 4, "分数的开关"),
    LEADER_SWITCH("leaderSwitch", 5, "上级评分的开关"),
    MY_SWITCH("mySwitch", 6, "自我评分的开关"),
    PLAN_SWITCH("planSwitch", 7, "进度开关"),
    ;

    @Getter
    private String code;
    @Getter
    private Integer value;
    @Getter
    private String desc;

    PeriodButtonTypeEnum(String code, Integer value, String desc) {
        this.code = code;
        this.value = value;
        this.desc = desc;
    }

    public static PeriodButtonTypeEnum getEnumByValue(Integer value) {
        if (value != null) {
            for (PeriodButtonTypeEnum periodButtonTypeEnum : PeriodButtonTypeEnum.values()) {
                if (periodButtonTypeEnum.getValue() == value) {
                    return periodButtonTypeEnum;
                }
            }
        }
        return null;
    }
}
